﻿@page
@{ Layout = "_Layout"; }

@section Styles{
    <style>

        .el-table th.el-table__cell > .cell {
            padding-left: 14px;
        }

        .el-tree-node {
            white-space: normal;
            outline: 0;
            .el-tree-node__content

        {
            text-align: left;
            align-items: start;
            height: 100%;
            .el-tree-node

        {
            white-space: normal;
            outline: 0;
            .el-tree-node__content

        {
            text-align: left;
            align-items: start;
            height: 100%;
        }

        }
        }
        }</style>
}
<el-card>
    <div slot="header" class="clearfix">
        <span>{{ groupName }}-用户安排</span>
        <el-button style="float: right;padding:3px 0;" type="text" v-on:click="utils.closeLayer(false)"><i class="el-icon-close"></i></el-button>
    </div>
    <el-row :gutter="18">
        <el-col :span="6">
            <el-card shadow="hover">
                <el-form :size="euiSize">
                    <el-form-item label="">
                        <el-input placeholder="输入关键字进行过滤"
                                  v-model="filterText" prefix-icon="el-icon-search" clearable>
                        </el-input>
                    </el-form-item>
                </el-form>
                <el-scrollbar class="scrollbar" :style="{height: $(window).innerHeight()-280 + 'px'}">
                    <el-tree class="filter-tree"
                             :data="organs"
                             v-on:node-click="btnTreeClick"
                             node-key="id"
                             accordion
                             :props="defaultProps"
                             :filter-node-method="filterNode"
                             ref="tree">
                    </el-tree>
                </el-scrollbar>
            </el-card>
        </el-col>
        <el-col :span="18">
            <el-form v-on:submit.native.prevent :inline="true" :model="formInline" :size="euiSize">
                <el-form-item label="">
                    <el-radio-group v-model="formInline.range" v-on:input="btnSearchClick">
                        <el-radio-button :label="0">待安排</el-radio-button>
                        <el-radio-button :label="1">已安排</el-radio-button>
                    </el-radio-group>
                </el-form-item>
                <br />
                <el-form-item label="关键字">
                    <el-input v-model="formInline.keyword" placeholder="关键字"></el-input>
                </el-form-item>
                <el-form-item label="排序">
                    <el-select v-model="formInline.order" placeholder="排序">
                        <el-option label="<默认>" value=""></el-option>
                        <el-option label="登录名称" value="UserName"></el-option>
                        <el-option label="最后登录日期" value="LastActivityDate"></el-option>
                        <el-option label="创建日期" value="CreatedDate"></el-option>
                        <el-option label="登录次数" value="CountOfLogin"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="最后登录">
                    <el-select v-model="formInline.lastActivityDate" placeholder="最后登录">
                        <el-option label="<全部时间>" :value="0"></el-option>
                        <el-option label="1天内" :value="1"></el-option>
                        <el-option label="2天内" :value="2"></el-option>
                        <el-option label="3天内" :value="3"></el-option>
                        <el-option label="1周内" :value="7"></el-option>
                        <el-option label="1个月内" :value="30"></el-option>
                        <el-option label="3个月内" :value="90"></el-option>
                        <el-option label="半年内" :value="180"></el-option>
                        <el-option label="1年内" :value="365"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="btnSearchClick">查询</el-button>
                    <template v-if="formInline.range==0">
                        <el-button :size="euiSize" plain type="primary" icon="el-icon-plus" v-on:click="btnRangeClick('select')">
                            安 排
                        </el-button>
                        <el-button :size="euiSize" plain type="primary" icon="el-icon-plus" v-on:click="btnRangeClick('all')">
                            全部安排
                        </el-button>
                    </template>
                    <template v-else>
                        <el-button :size="euiSize" plain type="warning" icon="el-icon-minus" v-on:click="btnRangeClick('select')">
                            移 出
                        </el-button>
                        <el-button :size="euiSize" plain type="warning" icon="el-icon-minus" v-on:click="btnRangeClick('all')">
                            全部移出
                        </el-button>
                    </template>
                    <el-button :size="euiSize" plain type="primary" icon="el-icon-download" v-on:click="btnExportClick">
                        导 出
                    </el-button>
                </el-form-item>
            </el-form>

            <el-table :data="items" :size="euiSize" ref="userTable" v-on:selection-change="handleSelectionChange"
                      style="width: 100%" :height="$(window).innerHeight()-370">
                <el-table-column type="selection"
                                 width="55">
                </el-table-column>
                <el-table-column label="账号">
                    <template slot-scope="scope">
                        <el-link :underline="false" type="primary" v-on:click="btnViewClick(scope.row)">{{scope.row.userName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column prop="displayName"
                                 label="姓名">
                </el-table-column>
                <el-table-column
                                 prop="lastActivityDate"
                                 label="上次登录">
                </el-table-column>
                <el-table-column prop="countOfLogin"
                                 label="登录次数">
                </el-table-column>
                <el-table-column label="" align="right" width="150">
                        <template slot-scope="scope">
                        <el-button-group>
                            <template v-if="formInline.range==0">
                                <el-button :size="euiSize" plain type="primary" v-on:click="btnRangeClick('only',scope.row.id)">
                                    安 排
                                </el-button>
                            </template>
                            <template v-else>
                                <el-button :size="euiSize" plain type="warning" v-on:click="btnRangeClick('only',scope.row.id)">
                                    移 出
                                </el-button>
                            </template>
                        </el-button-group>
                        </template>
                </el-table-column>
                @await Html.PartialAsync("_PartialTableEmpty")
            </el-table>

            <div style="text-align: center; margin-top: 10px;">
                <el-pagination v-on:current-change="handleCurrentChange" background
                               :current-page="formInline.currentPage"
                               :page-size="formInline.limit"
                               layout="total, prev, pager, next, jumper"
                               :total="count">
                </el-pagination>
            </div>
            </el-col></el-row>

</el-card>
<el-row align="center" style="margin-top:18px;">
    <el-col :span="24" align="center">
        <el-button :size="euiSize" v-on:click="utils.closeLayer(false)">关 闭</el-button>
    </el-col>
</el-row>
@section Scripts{
  <script src="/sitefiles/assets/js/admin/settings/usersGroupRange.js" type="text/javascript"></script>
}